home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Programming / LEDA / prog / graph / write_graph.c < prev   
C/C++ Source or Header  |  1994-08-05  |  704b  |  39 lines

  1. #include <LEDA/graph.h>
  2.  
  3.  
  4. void Read(GRAPH<float,float>& G, istream& is) { G.read(is); }
  5.  
  6. void Print(const GRAPH<float,float>& G, ostream& os) { G.write(os); }
  7.  
  8. int compare(const GRAPH<float,float>&, const GRAPH<float,float>&) { return 0; }
  9.  
  10. #if !defined(__TEMPLATE_FUNCTIONS__)
  11. typedef GRAPH<float,float> ff_graph;
  12. LEDA_TYPE_PARAMETER(ff_graph)
  13. #endif
  14.  
  15.  
  16. main()
  17. {
  18.   GRAPH<GRAPH<float,float>,string> G;
  19.  
  20.   test_graph(G);
  21.  
  22.   int  i = 0;
  23.   node v; 
  24.  
  25.   forall_nodes(v,G) 
  26.   { node x = G[v].new_node(17.5); 
  27.     node y = G[v].new_node(13.7); 
  28.     G[v].new_edge(x,y,0.1234);
  29.    }
  30.  
  31.   i = 0;
  32.   edge e;
  33.   forall_edges(e,G) G[e] = string("v%d",i++);
  34.  
  35.   G.write(read_string("write graph to file: "));
  36.  
  37.   return 0;
  38. }
  39.